import static org.junit.Assert.*;

import org.junit.*;

public class LiczbaTest4 {
	private Liczba l = null;
	private String toConv;
	private int base;
	
	/*
	 * This comment means nothing.
	 */
	@Before
	public void initialize() {
		toConv = "88";
		base = 8;
		try {
			l = new Liczba(toConv, base);
		} catch (LiczbaException e) {
			fail("Failed to create object Liczba");
		}
	}
	
	//Supposed to throw msg
	@Test
	public void test1() {
		assertEquals("assertEquals failed", l.toString(), "255");
	}
	
	@Test(expected=LiczbaException.class)
	public void test2() {
		try {
			l.zapis(1);
			fail();
		}
		catch (LiczbaException e) {
			
		}
	}
	
	//Supposed to throw timeout exception rather than incorrect base
	@Test(timeout=1)
	public void test3() {
		//System.out.println("Number " + l.toString() + " in base:"); //Should not print when timeout is only 1 ms
		for (int i=2; i<20; i++) {
			try {
				System.out.println(i+": "+l.zapis(i));
			}
			catch (LiczbaException ex) {
				fail("Incorrect base "+i);
			}
		}
	}
	
	//Comparing String to Integer but test is ignored
	@Ignore
	public void test4() {
		assertEquals("Not true", l.toString(), 255);
	}
	
	@After
	public void release() {
		l = null;
	}
}
